package com.atguigu.myssm.trans;

import com.atguigu.myssm.basedao.ConnUtils;

import java.sql.Connection;
import java.sql.SQLException;

public class TransactionManager {


    public static void beginTrans() throws SQLException {
        ConnUtils.getConn().setAutoCommit(false);

    }
    public static void commitTrans() throws SQLException {

           Connection connection =  ConnUtils.getConn();
           connection.commit();
           ConnUtils.CloseConn();

    }

    public static void rollbackTrans() throws SQLException {

        Connection connection = ConnUtils.getConn();
        connection.rollback();
        ConnUtils.CloseConn();

    }
}
